﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using CMS.Model;
using CMS.Channel;
using CMS.Contracts;
using CMSWCSFSolution.CMS.Views;
using CMSWCSFSolution.CMS.Interface.Services;


namespace CMSWCSFSolution.CMS.Views
{
    public class CreateStudentPresenter : Presenter<ICreateStudentView>
    {
        private ICMSService _service;
        public CreateStudentPresenter([CreateNew] ICMSService service)
        {
            _service = service;
        }
        /// <summary>
        /// Called when [selected all grades].
        /// </summary>
        public void  OnSelectedAllGrades()
        {
           View.BindClass= _service.GetAllGrades();
        }
        /// <summary>
        /// Called when [add student].
        /// </summary>
        public void  OnAddStudent()
        {
            Grade grade = new Grade();
            Student stu = new Student(grade);
            stu = View.studentInsert;
            _service.AddStudent(stu);
        }
        public override void OnViewLoaded()
        {
        }
        public override void OnViewInitialized()
        {
        }      
    }
}




